package com.itheima.set;

import java.util.Set;
import java.util.TreeSet;

/*
set的基本使用
增删
遍历
 */
public class Demo01 {

    public static void main(String[] args) {
       Set<String> set= new TreeSet<String>();
        // add  remove  removeif  contains isEmpty  size clear
        set.add("ghi");
        set.add("dere");
        set.add("abc");
        set.add("abc");
        set.add("uio");
        set.add("zhidfgd");
        set.add("xyzddd");
        System.out.println("长度是:"+set.size());
        System.out.println(set);
set.remove("ghi");
        System.out.println(set);
        set.removeIf(s->s.length()==3);
        System.out.println(set);
        System.out.println(set.contains("abc"));
        System.out.println(set.contains("xyzddd"));
        System.out.println("长度是:"+set.size());
        System.out.println(set.isEmpty());
        set.clear();
        System.out.println(set);
        System.out.println(set.isEmpty());



    }

}
